﻿@model List<DriverSummary>
@{
    ViewBag.Title = "Driver List";
}
<center>
    @(Html.Telerik().Grid(Model).Name("driverGrid")
        .DataKeys(k => k.Add(o => o.Id))
        .Columns(c =>
        {
            c.Bound(o => o.Id).ReadOnly().Width(30);
            c.Bound(o => o.UserId).ReadOnly().Width(90);
            c.Bound(o => o.Name).Width(140);
            c.Bound(o => o.TruckType).Width(120);
            c.Command(s =>
            {
                s.Edit();
            }).Width(120);
        })
        .DataBinding(b => b.Server().Update("UpdateDriver", "Drivers"))
        .HtmlAttributes(new { style = "width:760px" })
        .Filterable()
        .CellAction(cell =>
        {
            if (cell.Column.Title == "User Id")
                cell.Text = Html.ActionLink(cell.DataItem.UserId, "Detail", "Drivers", new { Id = cell.DataItem.Id }, null).ToString();
        })

)
    <br />
    <br />
    @Html.ActionLink("Register New Driver", "AddDriver", "Drivers") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    @Html.ActionLink("View Locations", "ListLocations", "Location")<br /><br />
</center>
